import request from "@/request/index.js";

// 数据采集入库相关API
export const dataCollectionApi = {
    // 手工录入数据
    manualInput(data) {
        return request({
            url: '/collection-service/dataCollectionWarehousing/manualInput',
            method: 'post',
            data: data
        })
    },

    // CSV文件上报
    csvUpload(formData) {
        return request({
            url: '/collection-service/dataCollectionWarehousing/csvUpload',
            method: 'post',
            data: formData,
            headers: {
                'Content-Type': 'multipart/form-data'
            }
        })
    },

    // 数据入库操作
    warehousing(data) {
        return request({
            url: '/collection-service/dataCollectionWarehousing/warehousing',
            method: 'post',
            data: data
        })
    },

    // 获取待入库数据列表
    getPendingList(params) {
        return request({
            url: '/collection-service/dataCollectionWarehousing/pendingList',
            method: 'get',
            params: params
        })
    },

    // 获取关区配置列表
    getCustomsAreaList() {
        return request({
            url: '/collection-service/dataCollectionWarehousing/customsAreaList',
            method: 'get'
        })
    },

    // 获取用户列表
    getUserList() {
        return request({
            url: '/collection-service/dataCollectionWarehousing/userList',
            method: 'get'
        })
    }
}

// 异常数据管理相关API
export const dataExceptionApi = {
    // 获取异常数据列表
    getExceptionList(params) {
        return request({
            url: '/collection-service/abnormalDataExplanation/list',
            method: 'get',
            params: params
        })
    },

    // 获取异常数据详情
    getExceptionDetail(id) {
        return request({
            url: `/collection-service/abnormalDataExplanation/detail/${id}`,
            method: 'get'
        })
    },

    // 处理异常数据
    handleException(data) {
        return request({
            url: '/collection-service/abnormalDataExplanation/handle',
            method: 'post',
            data: data
        })
    },

    // 批量处理异常数据
    batchHandleException(data) {
        return request({
            url: '/collection-service/abnormalDataExplanation/batchHandle',
            method: 'post',
            data: data
        })
    },

    // 创建异常数据记录
    createException(data) {
        return request({
            url: '/collection-service/abnormalDataExplanation/create',
            method: 'post',
            data: data
        })
    },

    // 获取异常统计信息
    getExceptionStatistics() {
        return request({
            url: '/collection-service/abnormalDataExplanation/statistics',
            method: 'get'
        })
    }
}

// 数据日志查询相关API
export const dataLogApi = {
    // 获取日志列表
    getLogList(params) {
        return request({
            url: '/collection-service/dataLog/list',
            method: 'get',
            params: params
        })
    },

    // 获取日志详情
    getLogDetail(id) {
        return request({
            url: `/collection-service/dataLog/detail/${id}`,
            method: 'get'
        })
    },

    // 获取模块统计信息
    getModuleStatistics() {
        return request({
            url: '/collection-service/dataLog/moduleStatistics',
            method: 'get'
        })
    },

    // 获取操作类型统计信息
    getTypeStatistics() {
        return request({
            url: '/collection-service/dataLog/typeStatistics',
            method: 'get'
        })
    },

    // 获取操作人员统计信息
    getOperatorStatistics() {
        return request({
            url: '/collection-service/dataLog/operatorStatistics',
            method: 'get'
        })
    },

    // 获取日志趋势分析
    getLogTrend(params) {
        return request({
            url: '/collection-service/dataLog/trend',
            method: 'get',
            params: params
        })
    },

    // 导出日志
    exportLogs(data) {
        return request({
            url: '/collection-service/dataLog/export',
            method: 'post',
            data: data
        })
    },

    // 清理历史日志
    cleanupLogs(data) {
        return request({
            url: '/collection-service/dataLog/cleanup',
            method: 'post',
            data: data
        })
    }
}
